using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using NTTHAO.Common;
using NTTHAO.Web.BL.Product;
using NTTHAO.CommonWeb;

public partial class admin_webparts_Plug_ins_Product_ProductTypeManagement : System.Web.UI.UserControl
{
    public bool _IsAdminLogged = false;
    public ProductType _Type = null;
    public ProductTypeConfig _Config = null;
    public DataTable _List = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        this._IsAdminLogged = "admin".Equals(Context.User.Identity.Name, StringComparison.OrdinalIgnoreCase);

        int typeID = 0;
        try
        {
            int groupID = Int32.Parse(Request.QueryString["g"].Trim());
            typeID = Int32.Parse(Request.QueryString["typeid"].Trim());

            if (typeID > 0)
            {
                this._Type = new ProductType(typeID);
            }
            this._Config = ProductTypeConfig.GetConfigByType(groupID, typeID);

            DataSet ds = null;
            if (typeID > 0)
            {
                ds = ProductType.GetAllByParent(_Type.ID);
            }
            else
            {
                ds = ProductType.GetAllRootByGroup(groupID);
            }
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                _List = ds.Tables[0];
            }
        }
        catch
        {
            return;
        }
    }
}
